/*
 * CnbiSoft JavaScript Library jQuery Plugin Copyright CnbiSoft
 * Technologies LLP License Information at <http://www.CnbiSoft.com/license>
 * 
 * @author CnbiSoft Technologies LLP
 * 
 * @version CnbiSoft/3.2.3-sr2.6105
 */
(function() {
	var j = CnbiSoft(["private", "extensions.jQueryPlugin"]);
	if (j !== void 0) {
		var b = window.jQuery, i, k, l;
		b.CnbiSoft = j.core;
		i = function(a, d) {
			var c, e, g, h;
			e = d instanceof Array || d instanceof b ? Math.min(a.length,
					d.length) : a.length;
			for (c = 0; c < e; c += 1)
				if (g = d instanceof Array || d instanceof b ? d[c] : d, a[c].parentNode)
					j.core.render(b.extend({}, g, {
								renderAt : a[c]
							}));
				else {
					g = new CnbiSoft(b.extend({}, g, {
								renderAt : a[c]
							}));
					if (!b.CnbiSoft.delayedRender)
						b.CnbiSoft.delayedRender = {};
					b.CnbiSoft.delayedRender[g.id] = a[c];
					h = document.createElement("script");
					h.setAttribute("type", "text/javascript");
					h.appendChild(document
							.createTextNode("CnbiSoft.items['" + g.id
									+ "'].render();"));
					a[c].appendChild(h)
				}
			return a
		};
		j.addEventListener("*", function(a, d) {
			var c;
			b.extend(a, b.Event("CnbiSoft" + a.eventType));
			a.sender && a.sender.options && a.sender.options.containerElementId
					? (c = a.sender.options.containerElementId, typeof c === "object"
							? b(c).trigger(a, d)
							: b("#" + c).length
									? b("#" + c).trigger(a, d)
									: b(document).trigger(a, d))
					: b(document).trigger(a, d)
		});
		k = function(a) {
			return a.filter(":CnbiSoft").add(a.find(":CnbiSoft"))
		};
		l = function(a, d, c) {
			typeof d === "object" && a.each(function() {
						this.configureLink(d, c)
					})
		};
		b.fn.insertCnbiSoft = function(a) {
			return i(this, a)
		};
		b.fn.appendCnbiSoft = function(a) {
			a.insertMode = "append";
			return i(this, a)
		};
		b.fn.prependCnbiSoft = function(a) {
			a.insertMode = "prepend";
			return i(this, a)
		};
		b.fn.attrCnbiSoft = function(a, d) {
			var c = [], b = k(this);
			if (d !== void 0)
				return b.each(function() {
							this.CnbiSoft.setChartAttribute(a, d)
						}), this;
			if (typeof a === "object")
				return b.each(function() {
							this.CnbiSoft.setChartAttribute(a)
						}), this;
			b.each(function() {
						c.push(this.CnbiSoft.getChartAttribute(a))
					});
			return c
		};
		b.fn.updateCnbiSoft = function(a) {
			var b, c, e, g, h, f = {}, j = k(this), i = [["swfUrl", !1],
					["height", !1], ["width", !1], ["bgColor", !0],
					["renderer", !0], ["dataFormat", !1], ["dataSource", !1],
					["detectFlashVersion", !0], ["autoInstallRedirect", !0],
					["lang", !0], ["scaleMode", !0], ["debugMode", !0]];
			b = 0;
			for (c = i.length; b < c; b += 1)
				h = i[b][0], a[h] && (i[b][1] && (g = !0), f[h] = a[h]);
			j.each(function() {
						e = this.CnbiSoft;
						if (g)
							e.clone(f).render();
						else {
							if (f.dataSource !== void 0
									|| f.dataFormat !== void 0)
								f.dataSource === void 0
										? e.setChartData(e.args.dataSource,
												f.dataFormat)
										: f.dataFormat === void 0 ? e
												.setChartData(f.dataSource,
														e.args.dataFormat) : e
												.setChartData(f.dataSource,
														f.dataFormat);
							(f.width !== void 0 || f.height !== void 0)
									&& e.resizeTo(f.width, f.height);
							if (f.swfUrl)
								e.src = f.swfUrl, e.render()
						}
					});
			return this
		};
		b.fn.cloneCnbiSoft = function(a, d) {
			var c, e;
			typeof a !== "function" && typeof d === "function"
					&& (e = a, a = d, d = e);
			c = [];
			k(this).each(function() {
						c.push(this.CnbiSoft.clone(d, {}, !0))
					});
			a.call(b(c), c);
			return this
		};
		b.fn.disposeCnbiSoft = function() {
			k(this).each(function() {
						this.CnbiSoft.dispose();
						delete this.CnbiSoft;
						this._fcDrillDownLevel === 0
								&& delete this._fcDrillDownLevel
					});
			return this
		};
		b.fn.convertToCnbiSoft = function(a, d) {
			var c = [];
			if (typeof a.dataConfiguration === "undefined")
				a.dataConfiguration = {};
			b.extend(!0, a.dataConfiguration, d);
			this.each(function() {
						c.push(b("<div></div>").insertBefore(this)
								.insertCnbiSoft(a).get(0))
					});
			return b(c)
		};
		b.fn.drillDownCnbiSoftTo = function() {
			var a, b, c, e, g, h = k(this);
			if (typeof this._fcDrillDownLevel === "undefined")
				this._fcDrillDownLevel = 0;
			a = 0;
			for (b = arguments.length; a < b; a += 1)
				if (g = arguments[a], g instanceof Array) {
					c = 0;
					for (e = g.length; c < e; c += 1)
						l(h, g[c], this._fcDrillDownLevel), this._fcDrillDownLevel += 1
				} else
					l(h, g, this._fcDrillDownLevel), this._fcDrillDownLevel += 1;
			return this
		};
		b.extend(b.expr[":"], {
					CnbiSoft : function(a) {
						return a.CnbiSoft instanceof j.core
					}
				})
	}
})();
